package se.sll.itintegration.catalogue.gui.service.view.users;

import java.util.List;

import org.apache.camel.Body;
import org.apache.camel.Exchange;
import org.apache.camel.Property;

import se.sll.itintegration.catalogue.gui.data.UsersView;
import se.sll.service.catalogue.common.rest.model.user.CareUnitReference;
import se.sll.service.catalogue.common.rest.model.user.User;

/**
 *
 * @author Christer Palm, Nogui
 */
public class UsersViewProcessor {
    public void create(Exchange exchange) {
        exchange.setProperty("view", new UsersView());
    }

    public void setUnits(Exchange exchange, @Property("view") UsersView view, @Body List<CareUnitReference> units) {
        view.setUnits(units);
    }

    public void setUsers(Exchange exchange, @Property("view") UsersView view, @Body List<User> users) {
        view.setUsers(users);
    }

    public void output(Exchange exchange, @Property("view") UsersView view) {
        exchange.getOut().setBody(view);
    }
}
